//Made by markyjoe1990 of Youtube
//Modified by Nintenlord

#define DISABLE_TUTORIALS
#include EAstdlib.event

EventPointerTable(0x06,Pointers) //0x06 is the prologue chapter

ORG 0x00D00000 //This is the offset where the event data will be written.
Pointers: //All the various pointers required for the chapter to function
POIN Turn_events
POIN Character_events 
POIN Location_events 
POIN Misc_events
POIN TrapData TrapData
POIN Bad Bad Bad Bad
POIN Good Good Good Good
POIN Opening_event Ending_event

//Useless
Bad:
UNIT

//Useless
Good:
UNIT

Turn_events:
TURN 0x00 CreateSides [1,0] 0x00 0x00 //Generates Player 1's Side and Player 2's Side
TURN 0x00 ChangePlayerA [1,999] 0x08 0x00 //Sets all sides to Ally after a player turn ends, effectively eliminating any enemy phase
TURN 0x00 ChangePlayerB [2,999] 0x00 0x00 //This is a check that allows the game to determine which player's turn it is
TURN 0x00 GiveEliwoodAssPull [03,00] 0x00 0x00 //Gives Eliwood the Durandal on the second phase of player 1
TURN

GiveEliwoodAssPull:
ITGC Eliwood Durandal
ENDA

ChangePlayerA: //Make both Player Sides into Allies at the end of player phase to eliminate enemy phase.
//Side A (List all Side A characters here)
TurnAlly(Eliwood)
//Side B (List all Side B characters here)
TurnAlly(Lyn_t)
ENDA

ChangePlayerB:
//If Event ID 0x04 is inactive, switch it to active and make all Side B units Allies, and Side A units enemies.
IFEF 0x00 0x04
JUMP Switch1
ENIF 0x00
//Otherwise, set Event ID 0x04 to inactive and make Side A units into Allies, and Side B units into enemies
JUMP Switch2
ENDA

Switch1:
//Set all of Side A to be enemies
TurnEnemy(Eliwood)
//Set all of Side B to be allies
TurnAlly(Lyn_t)
//Make Event ID 0x04 active
ENUT 0x04
ENDA

Switch2:
//Set all of Side A to be allies
TurnAlly(Eliwood)
//Set all of Side B to be enemies
TurnEnemy(Lyn_t)
//Make Event ID 0x04 inactive
ENUF 0x04
ENDA

CreateSides:
LOU1 CreateUnits
ENUN
OOBB
ENDA

CreateUnits:
//Side A
UNIT Eliwood EliwoodLord 0 Level(20,Ally,True) [4,5] [4,5] [IronSword, 0, 0, 0] [0, 0, 0, 0]
//Side B
UNIT Lyn_t LynLord 0 Level(20,Enemy,True) [10,5] [10,5] [IronSword, 0, 0, 0] [0, 0, 0, 0]
UNIT Empty

Character_events:
CHAR

Location_events:
LOCA

Misc_events:
CauseGameOverIfLordDies
AFEV

Opening_event:
ENDA

Ending_event:
MoveToChapter(1)

TrapData:
ENDTRAP

MESSAGE Events end at offset currentOffset
//The map for this chapter is at offset: ????????